#!/bin/bash

# names of raw hex files (output from ganyantra)
filenames=("final" "final2" "final3")

# number of bytes after which corresponding above files are to be written at
addrhex=(200 300 400)

# size in bytes of memory to be written
memory=224k

dd if=/dev/zero of=ch32v203 bs=$memory count=1

len="${#filenames[*]}"

for (( i=0 ; i<len ; i++)); do
	dd if=${filenames[i]} of=ch32v203 obs=${addrhex[i]} conv=notrunc seek=1
done

echo "Done hai ji."